
{% extends "helios/templates/cryptobase.html" %}

{% block title %}Trustees for {{election.name}}{% endblock %}

{% block content %}
  <h3 class="title">{{election.name}} &mdash; 受委托人 <span style="font-size:0.7em;">[<a href="{% url "election@view" election.uuid %}">返回选举</a>]</span></h3>

<p>
    受托人负责解密选举结果.<br />
    每个受托人生成一个密钥对并将公共部分提交给 Helios.<br />
    当需要解密时，每个受托人都需要提供他们的密钥.
</p>

{% if not election.frozen_at %}

<p>
  Helios 自动成为您的第一个受托人，并将自动处理其密钥对生成和解密.<br />
  如果需要，您可以添加其他受托人，甚至可以删除 Helios 受托人.<br />
  但是，我们建议您仅在您对受托人的角色有充分了解的情况下才这样做.
</p>

{% if admin_p %}
<p>
    [ <a onclick="return(confirm('Adding your own trustee requires a good bit more work to tally the election.\nYou will need to have trustees generate keypairs and safeguard their secret key.\n\nIf you are not sure what that means, we strongly recommend\nclicking Cancel and letting Helios tally the election for you.'));" href="{% url "election@trustees@new" election.uuid %}">添加受委托人</a> ]
</p>
{% if not election.has_helios_trustee %}
<p>
    <a href="{% url "election@trustees@add-helios" election.uuid %}">添加helios作为受委托人</a>
</p>
{% endif %}
{% endif %}

{% endif %}

{% if not trustees|length %}

{% else %}
{% for t in trustees %}
<h5> Trustee #{{forloop.counter}}: {{t.name}}
{% if admin_p %}
{% if t.secret_key %}
{% if not election.frozen_at %}[<a onclick="return confirm('Are you sure you want to remove Helios as a trustee?');" href="{% url "election@trustees@delete" election.uuid %}?uuid={{t.uuid}}">x</a>]{% endif %}
{% else %}
({{t.email}})
{% if not election.frozen_at %}[<a onclick="return confirm('Are you sure you want to remove this Trustee?');" href="{% url "election@trustees@delete" election.uuid %}?uuid={{t.uuid}}">x</a>]{% endif %}
[<a onclick="return confirm('Are you sure you want to send this trustee his/her admin URL?');" href="{% url "election@trustee@send-url" election.uuid t.uuid %}">发送登录链接</a>]
{% endif %}
{% endif %}
</h5>

<p>
{% if t.public_key_hash %}
  公钥身份码: <tt style="font-size:1.5em;">{{t.public_key_hash}}</tt>
{% else %}
未上传公钥.
{% endif %}
</p>

{% if election.encrypted_tally %}
{% if t.decryption_factors %}
<b>为该受托人记录的计数.</b>
{% else %}
<em>等待该受托人计数</em>
{% endif %}
{% endif %}
</li>
{% endfor %}
</ul>

{% endif %}

{% endblock %}
